<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/template_1.xhtml">
        <ui:define name="title">
            <h:outputText value="Register agent"></h:outputText>
        </ui:define>
        <ui:define name="body">
            <h:panelGroup id="messagePanel" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputLabel value="username: " for="username" />
                    <h:inputText id="username" value="#{userController.selected.username}" title="#{bundle.CreateUserTitle_username}" required="true" requiredMessage="#{bundle.CreateUserRequiredMessage_username}"/>
                    <h:outputLabel value="password" for="password" />
                    <h:inputSecret id="password" value="#{userController.selected.password}" title="#{bundle.CreateUserTitle_password}" required="true" requiredMessage="#{bundle.CreateUserRequiredMessage_password}"/>
                    <h:outputLabel value="first name: " for="firstname" />
                    <h:inputText id="firstname" value="#{userController.firstName}" title="first name" required="true" requiredMessage="first name is mandatory!"/>
                    <h:outputLabel value="last name: " for="lastname" />
                    <h:inputText id="lastname" value="#{userController.lastName}" title="last name" required="true" requiredMessage="last name is mandatory!"/>
                    <h:outputLabel value="email: " for="email" />
                    <h:inputText id="email" value="#{userController.selected.email}" title="#{bundle.CreateUserTitle_email}" required="true" requiredMessage="#{bundle.CreateUserRequiredMessage_email}"/>
                    <h:outputLabel value="Agency name: " for="agencyName" />
                    <h:inputText id="agencyName" value="#{userController.agencyName}" title="Agency name" required="true" requiredMessage="Agency name is required!"/>
                    <h:outputLabel value="phone: " for="phone" />
                    <h:inputText id="phone" value="#{userController.phone}" title="phone" required="true" requiredMessage="Phone is required!"/>

                </h:panelGrid>
                <br />
                <h:commandButton action="#{userController.createAgent}" value="register new agent" />
                <br />
            </h:form>
        </ui:define>
    </ui:composition>

</html>
